<template>
	<view>
		<view class="tab">
			<view class="tab_item" v-for="(item,index) in tabs" :key="index" @click="onChange(index)">
				<text :class="{'active':activeIn==index}">{{item.value+item.code}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'lr-tabs',
		data() {
			return {
				activeIn: 0,
			}
		},
		props: {
			tabs: {
				type: Array,
				default () {
					return []
				}
			}
		},
		methods: {
			onChange(index) {
				this.activeIn = index;
				this.$emit('change', this.activeIn)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.tab {
		background-color: #F5F5F5;
		display: flex;
		flex-direction: row;
		/* justify-content: space-around; */
		align-items: center;
		// margin-top: 18upx;
		padding: 18upx 40upx;
	}

	.tab_item {
		width: 0;
		flex-grow: 1;
		display: flex;
		justify-content: center;
		box-sizing: border-box;
		color: #333333;
		font-size: 26upx;

		text {
			font-family: PingFang SC, PingFang SC-Medium;
			font-weight: bold;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
		}
	}


	.active {
		box-sizing: border-box;
		color: #009B01;
		font-size: 30upx;
		font-family: PingFang SC, PingFang SC-Bold;
		font-weight: bold;
		text-align: center;
		// line-height: 67upx;
		position: relative;
		padding: 10upx 20upx;
		border: 3upx solid #009B01;
		border-radius: 90upx;


	}
</style>
